<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateUserIdcardDetailTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_idcard_detail', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('userId')->default(0)->comment('用户ID');
            $table->string('facePhoto', 120)->default('')->comment('正面照');
            $table->string('backPhoto', 120)->default('')->comment('反面照(国徽面)');
            $table->string('name', 24)->default('')->comment('用户名');
            $table->string('idCardNumber', 18)->default('')->comment('身份证号');
            $table->unsignedTinyInteger('gender')->default(0)->comment('性别');
            $table->unsignedInteger('birthDate')->default(0)->comment('出生年月日');
            $table->string('address', 120)->default('')->comment('地址');
            $table->string('nation', 12)->default('')->comment('籍贯');
            $table->string('office', 120)->default('')->comment('签发机关');
            $table->unsignedInteger('startDate')->default(0)->comment('有效开始时间');
            $table->integer('endDate')->default(0)->comment('有效结束日期');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');

            $table->index('userId', 'idx_userId');

            $table->comment = '用户身份证信息';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_idcard_detail');
    }
}
